/** 
*	DefaultAI is, as the name suggests, the basic AI that a combatant is
*	initialized with.  It is very stupid and attacks randomly.
*/
public class DefaultAI implements AI
{
	Combatant lastAttacked;
	public void doTurn(Encounter eEncounter, Party pParty, Combatant cUnit)
	{
		Combatant target = null;
		if (lastAttacked != null)
		{
			if(lastAttacked.getHP() > 0)
			{
				target = lastAttacked;
			}
		}
		
		if (target == null)
		{
			Party enemyParty = eEncounter.getORParty(pParty);
			if(enemyParty != null)
			{
				target = enemyParty.getRUnit();
			}
		}
		if (target != null)
		{
			String sMessage = cUnit.getName() + " is attacking "+target.getName();
			eEncounter.printLog(sMessage);
			Action aAtWill = cUnit.getRAtwill();
			aAtWill.doAction(target);
			lastAttacked = target;
		}
	}
}
